#ifndef _WORLD_HPP
#define _WORLD_HPP
#include "Singleton.hpp"
#include <cstdint>
#include <memory>
#include <mutex>
#include "WorldSession.hpp"

class Player;
class World
{
private:
    World() = default;
    ~World() = default;

    World(World const& other) = delete;
    World(World&& other) = delete;
    World& operator=(World const& other) = delete;
    World& operator=(World&& other) = delete;
public:
    friend class Singleton<World>;
public:
    bool Init();
    bool Update(uint32_t diff);
    void Stop();
    void AddSession(std::shared_ptr<WorldSession>&& session);
private:
    std::mutex _newSessionMutex;
    std::list<std::shared_ptr<WorldSession>> _newSessions;
    std::list<std::shared_ptr<Player>> _sessions;
};

#define sWorld Singleton<World>::getInstance()

#endif